package com.eastfair.builder.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 报馆图纸分类
 * </p>
 *
 * @author dq
 * @date 2022-08-06
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ReportDrawingCategoryAuditStatusEnum", description = "审核状态 #{NOT_SUBMIT:未提交;SUBMIT:已提交;APPROVED:审核通过;NOT_APPROVED:审核未通过-枚举")
public enum ReportDrawingCategoryAuditStatusEnum implements BaseEnum {

    /**
     * NOT_SUBMIT="未提交"
     */
    NOT_SUBMIT("未提交"),
    /**
     * SUBMIT="已提交"
     */
    SUBMIT("已提交"),
    /**
     * APPROVED="审核通过"
     */
    APPROVED("审核通过"),
    /**
     * NOT_APPROVED="审核未通过"
     */
    NOT_APPROVED("审核未通过"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ReportDrawingCategoryAuditStatusEnum match(String val, ReportDrawingCategoryAuditStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ReportDrawingCategoryAuditStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ReportDrawingCategoryAuditStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_SUBMIT,SUBMIT,APPROVED,NOT_APPROVED", example = "NOT_SUBMIT")
    public String getCode() {
        return this.name();
    }

}
